package life;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 *  子串
 *  子集和子串不一样  子集是不按顺序的  子串必须按照主串的顺序
 */
public class SubStringDemo {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        String s= "leetcode";
        for (int i = 0; i < s.length(); i++) {
            for (int j = i+1; j <= s.length(); j++) {
                list.add(s.substring(i,j));
            }
        }
        System.out.println(Collections.max(list));
//        System.out.println(list);
    }
}
